﻿using Microsoft.IdentityModel.JsonWebTokens;
using System.Security.Cryptography;

//生成一个jwt秘钥
static string GenerateHS256Key()
{
    using (var rng = RandomNumberGenerator.Create())
    {
        byte[] keyBytes = new byte[32]; // 256 bits
        rng.GetBytes(keyBytes);
        return Convert.ToBase64String(keyBytes);
    }
}

Console.WriteLine(GenerateHS256Key());

Console.ReadLine();